package com.tjetc.controller;

import com.tjetc.domain.dto.UserDTO;
import com.tjetc.service.UserService;
import com.tjetc.utils.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("user")
@RequiredArgsConstructor
public class LoginController {

    private final UserService userService;

    @PostMapping("login")
    public Result login(@RequestBody UserDTO userDTO){
        log.info("用户登录：{}",userDTO);
        return userService.login(userDTO);
    }
    @PostMapping("register")
    public Result register(@RequestBody UserDTO userDTO){
        log.info("用户注册:{}",userDTO);
        return userService.register(userDTO);
    }
}
